package com.leoman.user.dao;

import com.leoman.common.dao.IBaseJpaRepository;
import com.leoman.user.entity.UserLogin;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2016/6/12.
 */
public interface UserLoginDao extends IBaseJpaRepository<UserLogin> {

    @Query("select userLogin from UserLogin userLogin where userLogin.username = ?1")
    public UserLogin findByUsername(String username);

    //查询用户最后登录时间是否在今天
    @Query("SELECT a FROM UserLogin a WHERE a.username = ?1 and a.lastLoginDate >= ?2 AND a.lastLoginDate < ?3")
    public List<UserLogin> lastLoginDate(String username, Long morningDate, Long nightDate);
}
